// 侧边栏
$(".center .box2").mouseover(function(){
    $(".gwccd").stop();
    $(".gwccd").slideDown("100","swing",function(){
        console.log("完成了")
    }
    )
})
$(".center .box2").mouseleave(function(){
    $(".gwccd").stop();
    $(".gwccd").slideUp("100","swing",function(){
        console.log("完成了")
    }
    )
})
// 购物车下滑
var gwclm=document.querySelector(".center .box2")
var gwcys=document.querySelector(".center .box2 i")
var gwcys2=document.querySelector(".center .box2 span")
gwclm.onmouseenter=function(){
    gwcys.style.color="#ff6700"
    gwcys2.style.color="#ff6700"
    gwclm.style.background="#fff"
}
gwclm.onmouseleave=function(){
    gwcys.style.color="#bba7a0"
    gwcys2.style.color="#bba7a0"
    gwclm.style.background="#424242"
}
var cdlbt =document.querySelector(".caidan")
var cdlbt1=document.querySelector(".xym1")
cdlbt.onmouseenter=function(){
    cdlbt1.style.display="block"
}
cdlbt.onmouseleave=function(){
    cdlbt1.style.display="none"
}
// 到时抢购
function seckill(){
    var dqsj=new Date()
    // 获取时间差，单位为秒
    var kssj=new Date("2022-5-8 21:00:00");
    var jssj=kssj.getTime();
    var diff = jssj - dqsj;
    diff = diff/1000;
    if(diff>0){
       var h=parseInt(diff/3600);
       diff = diff - h*3600;
      var  m=parseInt(diff/60 );
      diff = diff - m*60
      var  s=parseInt(diff);
        h = h<10 ? '0' + h : h +":";
        m = m<10 ? '0' + m : m +":";
        s = s<10 ? '0' + s : s ;
    }else{
        clearInterval(id);
        h=m=s="00"
    }
document.getElementById("msybx-1").innerHTML=h
document.getElementById("msybx-3").innerHTML=m
document.getElementById("msybx-5").innerHTML=s
}
if(seckill()>0){
    seckill-1;
    
}
var id=setInterval(seckill,1000);

//点击进入详情页
// var sqy=document.querySelectorAll(".sjbx-3")[0]
// console.log(sqy);
// sqy.onclick=function(){
//    location.href = "../xqy.html"
// }
// var sqy1=document.
// querySelectorAll(".sjbx-3")[1]
// sqy1.onclick=function(){
//    location.href = "../xqy copy.html"
// }
// //点击购物车跳转到购物车
// var gwc=document.querySelector(".center .box2")
// gwc.onclick=function(){
//     location.href="../gwc.html"
// }
